package plateforme.controlleur;


import java.sql.DriverManager;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;

/**
 * Servlet implementation class ControlleurValiderSuppPerson
 */
public class ControlleurValiderSuppPerson extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
		
		String connectionURL = "jdbc:mysql://localhost:3306/laas";
		Connection connection = null;
		try {
			 String  login=request.getParameter("login");
				

			
      //System.out.println(id+nom+prenom);
		 
	  
		 
		 Class.forName("com.mysql.jdbc.Driver");

			// Get a Connection to the database

			connection = (Connection) DriverManager.getConnection(
		  connectionURL, "root", "");
			
			String sql = "delete from personne where login='"+login+"'" ;

			Statement s = (Statement) connection.createStatement();

			s.executeUpdate(sql);
			response.sendRedirect("admin.jsp");
System.out.println("succes upadte");
		
			
	   
			// response.setContentType("text/html");
		 
System.out.println("suppression avec succes ");



response.setContentType("text/html");






}catch(Exception e){

	  System.out.println("Exception is ;"+e);

	  }




}
}
